<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="VoloEditDlg" widgetVar="VoloEditDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.EditVoloTitle}" closeOnEscape="true">

            <h:form id="VoloEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" rendered="#{voloController.selected != null}">

                        <h:outputLabel value="#{myBundle.EditVoloLabel_idVOLO}" for="idVOLO" />
                        <h:outputText id="idVOLO" value="#{voloController.selected.idVOLO}" />

                        <p:outputLabel value="#{myBundle.EditVoloLabel_prezzo}" for="prezzo" />
                        <p:inputText id="prezzo" value="#{voloController.selected.prezzo}" title="#{myBundle.EditVoloTitle_prezzo}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_prezzo}"/>

                        <p:outputLabel value="#{myBundle.EditVoloLabel_data}" for="data" />
                        <p:calendar id="data" pattern="MM/dd/yyyy" value="#{voloController.selected.data}" title="#{myBundle.EditVoloTitle_data}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_data}" showOn="button"/>

                        <p:outputLabel value="#{myBundle.EditVoloLabel_durata}" for="durata" />
                        <p:calendar id="durata" pattern="HH:mm:ss" value="#{voloController.selected.durata}" title="#{myBundle.EditVoloTitle_durata}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_durata}" showOn="button"/>

                        <p:outputLabel value="#{myBundle.EditVoloLabel_elemento}" for="elemento" />
                        <p:selectOneMenu id="elemento" value="#{voloController.selected.elemento}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_elemento}" converter="elementoConverter">
                            <f:selectItem itemLabel="#{myBundle.SelectOneMessage}"/>
                            <f:selectItems value="#{elementoController.items}"
                                           var="elementoItem"
                                           itemValue="#{elementoItem}"
                                           itemLabel="#{elementoItem.idELEMENTO.toString()}"
                                           />

                        </p:selectOneMenu>

                        <p:outputLabel value="#{myBundle.EditVoloLabel_compagnia}" for="compagnia" />
                        <p:selectOneMenu id="compagnia" value="#{voloController.selected.compagnia}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_compagnia}" converter="compagniaConverter">
                            <f:selectItem itemLabel="#{myBundle.SelectOneMessage}"/>
                            <f:selectItems value="#{compagniaController.items}"
                                           var="compagniaItem"
                                           itemValue="#{compagniaItem}"
                                           itemLabel="#{compagniaItem.nome.toString()}"
                                           />

                        </p:selectOneMenu>

                        <p:outputLabel value="#{myBundle.EditVoloLabel_arrivo}" for="arrivo" />
                        <p:selectOneMenu id="arrivo" value="#{voloController.selected.arrivo}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_arrivo}" converter="cittaConverter">
                            <f:selectItem itemLabel="#{myBundle.SelectOneMessage}"/>
                            <f:selectItems value="#{cittaController.items}"
                                           var="arrivoItem"
                                           itemValue="#{arrivoItem}"
                                           itemLabel="#{arrivoItem.nome.toString()}"
                                           />

                        </p:selectOneMenu>

                        <p:outputLabel value="#{myBundle.EditVoloLabel_partenza}" for="partenza" />
                        <p:selectOneMenu id="partenza" value="#{voloController.selected.partenza}" required="true" requiredMessage="#{myBundle.EditVoloRequiredMessage_partenza}" converter="cittaConverter">
                            <f:selectItem itemLabel="#{myBundle.SelectOneMessage}"/>
                            <f:selectItems value="#{cittaController.items}"
                                           var="partenzaItem"
                                           itemValue="#{partenzaItem}"
                                           itemLabel="#{partenzaItem.nome.toString()}"
                                           />

                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{voloController.save}" value="#{myBundle.Save}" update="display,:VoloListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,VoloEditDialog);"/>
                    <p:commandButton value="#{myBundle.Cancel}" onclick="VoloEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
